<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成绩管理 - 学生信息管理系统</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="container">
            <a href="index.jsp" class="navbar-brand">学生信息管理系统</a>
            <ul class="navbar-menu">
                <li><a href="index.jsp">首页</a></li>
                <li><a href="student-management.jsp">学生管理</a></li>
                <li><a href="class-management.jsp">班级管理</a></li>
                <li><a href="score-management.jsp">成绩管理</a></li>
                <li><a href="#" onclick="alert('退出登录'); return false;">退出登录</a></li>
            </ul>
        </div>
    </nav>
    
    <div class="container">
        <h1>成绩管理</h1>
        
        <!-- 显示消息提示 -->
        <% if (request.getAttribute("message") != null) { %>
            <div class="message success">
                <%= request.getAttribute("message") %>
            </div>
        <% } %>
        
        <% if (request.getAttribute("error") != null) { %>
            <div class="message error">
                <%= request.getAttribute("error") %>
            </div>
        <% } %>
        
        <!-- 操作栏 -->
        <div class="action-bar">
            <a href="score-form.jsp" class="btn btn-primary">添加成绩</a>
            <a href="#" id="importScoresBtn" class="btn btn-secondary">导入成绩</a>
            <a href="#" id="exportScoresBtn" class="btn btn-info">导出成绩</a>
            <a href="#" id="calculateStatisticsBtn" class="btn btn-success">计算统计</a>
            
            <!-- 搜索和筛选区域 -->
            <div class="search-filter">
                <input type="text" id="searchInput" placeholder="搜索学生姓名或学号" class="search-input">
                
                <select id="courseFilter" class="filter-select">
                    <option value="">所有课程</option>
                    <option value="math">高等数学</option>
                    <option value="english">大学英语</option>
                    <option value="programming">程序设计基础</option>
                    <option value="database">数据库原理</option>
                </select>
                
                <select id="gradeFilter" class="filter-select">
                    <option value="">所有年级</option>
                    <option value="2020">2020级</option>
                    <option value="2021">2021级</option>
                    <option value="2022">2022级</option>
                    <option value="2023">2023级</option>
                </select>
                
                <select id="classFilter" class="filter-select">
                    <option value="">所有班级</option>
                    <option value="CS202301">计算机2023级1班</option>
                    <option value="CS202302">计算机2023级2班</option>
                    <option value="SE202301">软件工程2023级1班</option>
                    <option value="NE202301">网络工程2023级1班</option>
                    <option value="AI202301">人工智能2023级1班</option>
                </select>
                
                <button id="searchBtn" class="btn btn-secondary">搜索</button>
            </div>
        </div>
        
        <!-- 成绩列表表格 -->
        <div class="table-container">
            <table class="data-table">
                <thead>
                    <tr>
                        <th><input type="checkbox" id="selectAll"></th>
                        <th>学生姓名</th>
                        <th>学号</th>
                        <th>班级</th>
                        <th>课程</th>
                        <th>分数</th>
                        <th>等级</th>
                        <th>考试日期</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="scoreTableBody">
                    <!-- 模拟数据 -->
                    <tr>
                        <td><input type="checkbox" class="selectRow" data-id="1"></td>
                        <td>张三</td>
                        <td>202301001</td>
                        <td>计算机2023级1班</td>
                        <td>高等数学</td>
                        <td class="score" data-score="95">95</td>
                        <td class="grade-excellent">优秀</td>
                        <td>2024-01-15</td>
                        <td>
                            <a href="score-form.jsp?id=1" class="btn btn-small btn-info">编辑</a>
                            <a href="#" class="btn btn-small btn-danger delete-btn" data-id="1">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="selectRow" data-id="2"></td>
                        <td>李四</td>
                        <td>202301002</td>
                        <td>计算机2023级1班</td>
                        <td>高等数学</td>
                        <td class="score" data-score="88">88</td>
                        <td class="grade-good">良好</td>
                        <td>2024-01-15</td>
                        <td>
                            <a href="score-form.jsp?id=2" class="btn btn-small btn-info">编辑</a>
                            <a href="#" class="btn btn-small btn-danger delete-btn" data-id="2">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="selectRow" data-id="3"></td>
                        <td>王五</td>
                        <td>202301003</td>
                        <td>计算机2023级2班</td>
                        <td>高等数学</td>
                        <td class="score" data-score="76">76</td>
                        <td class="grade-pass">中等</td>
                        <td>2024-01-15</td>
                        <td>
                            <a href="score-form.jsp?id=3" class="btn btn-small btn-info">编辑</a>
                            <a href="#" class="btn btn-small btn-danger delete-btn" data-id="3">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="selectRow" data-id="4"></td>
                        <td>赵六</td>
                        <td>202301004</td>
                        <td>软件工程2023级1班</td>
                        <td>高等数学</td>
                        <td class="score" data-score="65">65</td>
                        <td class="grade-fail">及格</td>
                        <td>2024-01-15</td>
                        <td>
                            <a href="score-form.jsp?id=4" class="btn btn-small btn-info">编辑</a>
                            <a href="#" class="btn btn-small btn-danger delete-btn" data-id="4">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="selectRow" data-id="5"></td>
                        <td>钱七</td>
                        <td>202301005</td>
                        <td>人工智能2023级1班</td>
                        <td>高等数学</td>
                        <td class="score" data-score="55">55</td>
                        <td class="grade-fail">不及格</td>
                        <td>2024-01-15</td>
                        <td>
                            <a href="score-form.jsp?id=5" class="btn btn-small btn-info">编辑</a>
                            <a href="#" class="btn btn-small btn-danger delete-btn" data-id="5">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        
        <!-- 统计信息 -->
        <div class="statistics">
            <div class="stat-item">
                <span class="stat-label">平均分：</span>
                <span class="stat-value" id="averageScore">75.8</span>
            </div>
            <div class="stat-item">
                <span class="stat-label">最高分：</span>
                <span class="stat-value" id="highestScore">95</span>
            </div>
            <div class="stat-item">
                <span class="stat-label">最低分：</span>
                <span class="stat-value" id="lowestScore">55</span>
            </div>
            <div class="stat-item">
                <span class="stat-label">及格率：</span>
                <span class="stat-value" id="passRate">80%</span>
            </div>
        </div>
        
        <!-- 分页控件 -->
        <div class="pagination">
            <button class="pagination-btn" disabled>&laquo; 上一页</button>
            <button class="pagination-btn active">1</button>
            <button class="pagination-btn">2</button>
            <button class="pagination-btn">3</button>
            <button class="pagination-btn">下一页 &raquo;</button>
            <span class="pagination-info">共 25 条记录，每页 5 条</span>
        </div>
        
        <!-- 批量操作 -->
        <div class="batch-operations">
            <button id="batchDeleteBtn" class="btn btn-danger">批量删除</button>
            <button id="batchUpdateBtn" class="btn btn-secondary">批量修改</button>
        </div>
    </div>
    
    <!-- 导入成绩对话框（默认隐藏） -->
    <div id="importDialog" class="dialog" style="display: none;">
        <div class="dialog-content">
            <h3>导入成绩</h3>
            <div class="dialog-body">
                <p>请上传Excel或CSV格式的成绩文件</p>
                <input type="file" id="scoreFile" accept=".xlsx,.xls,.csv">
                <p style="margin-top: 10px; font-size: 14px; color: #666;">提示：请确保文件格式正确，包含学生学号、姓名、课程、分数等必要字段</p>
            </div>
            <div class="dialog-footer">
                <button id="confirmImportBtn" class="btn btn-primary">确认导入</button>
                <button id="cancelImportBtn" class="btn btn-secondary">取消</button>
            </div>
        </div>
    </div>
    
    <script src="js/script.js"></script>

</body>
</html>